<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加学生</title>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
</head>
<body>
<div style="margin: 50px 50px 50px 50px;">

    <form class="layui-form" action="">
        <div class="layui-form-item" th:if="${student.getUsername() == null}">
            <label class="layui-form-label">
                <a href="http://localhost:8080/user/student/index.html" class="layui-btn layui-btn-normal">返回</a>
            </label>
        </div>
        <div class="layui-form-item" th:if="${student.getId() != 0}">
            <input type="hidden" name="id" th:value="${student.getId()}">
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-block">
                <input type="text" name="username" th:value="${student.getUsername()}" required  lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-block">
                <input type="password" name="password" th:value="${student.getPassword()}" required  lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block">
                <input type="text" name="sex" th:value="${student.getSex()}" required  lay-verify="required" placeholder="请输入性别" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">年纪</label>
            <div class="layui-input-block">
                <input type="text" name="age" th:value="${student.getAge()}" required  lay-verify="required" placeholder="请输入年纪" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">班级</label>
            <div class="layui-input-block">
                <select name="gradeId" lay-verify="required">
                    <option>请选择班级</option>
                    <option th:each="grade:${gradeList}" th:value="${grade.getId()}" th:text="${grade.getName()}" th:selected="${grade.getId() == student.getId()}"></option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" type="button" lay-submit lay-filter="formSubmit">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary" th:if="${student.getId() == 0}">重置</button>
            </div>
        </div>
    </form>
</div>

</body>
<script src="/layui/layui.js"></script>
<script src="/js/jquery.min.js"></script>
<script src="/js/user/student/add.js"></script>
</html>